package org.vestbjergbyggecenter.Test;

import static org.junit.Assert.*;

import org.junit.Test;
import org.vestbjergbyggecenter.Model.Category;
import org.vestbjergbyggecenter.Model.Customer;
import org.vestbjergbyggecenter.Model.Order;
import org.vestbjergbyggecenter.Model.Product;
import org.vestbjergbyggecenter.Model.SalesAssistant;

public class TestSalesAssistant {

	@Test
	//get and set for the id
	public void testSalesAssistantID() 
	{
		SalesAssistant salesAssistant=new SalesAssistant(1,"imeto",12344567,"mainata si",920203,
				"Aalborg","22934554","Shefa","parolata",30000);
		salesAssistant.setId(5);
		assertEquals(5, salesAssistant.getId());
	}
	
	@Test
	public void testCalculateNorm()
	{
		long date=121212;
		
		SalesAssistant salesAssistant=new SalesAssistant(5,"imeto",12344567,"mainata si",920203,
				"Aalborg","22934554","Shefa","parolata",30000);
		
		//OrderRecords orderRecords=OrderRecords.getInstance();
		
		Category category1=new Category("newb", 10);
		Category category2=new Category("free Stuff", 10);
		
		Customer customer=new Customer(22, "khan", 1256265, "address", 450855, "velenta", "07548255", category1);
		
		Product product1=new Product(1, "product", category2, 100.0, 1, "home");
		Product product2=new Product(2, "produs", category1, 100.0, 1, "grave");		
		
		Order order1=new Order(12, date, "alive", customer, salesAssistant);
		order1.addProduct(product2);
		
		Order order2=new Order(13, date, "dead", customer, salesAssistant);
		order2.addProduct(product1);
		
		//orderRecords.addOrder(order1);
		//orderRecords.addOrder(order2);
		
		salesAssistant.addMadeOrder(order1);
		salesAssistant.addMadeOrder(order2);
	
		double normLeft=salesAssistant.calculateNorm(salesAssistant.getSalesAssistanID());
		
		assertEquals(2499840, normLeft, 0);	
		}


}
